﻿#region using references
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web.Caching;
using System.Web.UI;
using Lbb.WSK;
#endregion

/// <summary>
/// Gets the MasterPage for the user selected Admin Theme.
/// </summary>
public class GetAdminMasterPage : IGetMasterPage
{
    #region IGetMasterPage 成员

    public string GetMasterPagePath()
    {
        using (var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["dbMyCMSConnectionString"].ConnectionString))
        using (var cmd = new SqlCommand("sp_admin_SelectMasterPage", conn))
        {
            cmd.CommandType = CommandType.StoredProcedure;
            conn.Open();

            using (var myReader = cmd.ExecuteReader(CommandBehavior.SingleResult))
            {
                if (myReader.Read())
                {
                    return myReader["ThemeUrl"] as string;
                }
            }
        }
        return string.Empty;
    }

    #endregion
}